<?php
/**
 * @ClassName: CommonEnum
 * @Description: 公共枚举
 * @author: gydtrade
 * @Date: 2024-09-09 21:42
 * @Version: V1.0.0
 */

namespace app\common\enum;

class CommonEnum
{
    const del_yes = 1;
    const del_no = 0;
    const TRUE = 1;
    const FALSE = 0;

    const check_stay = 0;//待审核
    const check_success = 1;//审核成功
    const check_fail = 2;//审核失败

    const shop = 1;
    const water = 2;

    public static function delText($status)
    {
        $desc = [
            CommonEnum::del_yes => '删除',
            CommonEnum::del_no => '正常',
        ];
        if ($status === true) {
            return $desc;
        }
        return isset($desc[$status]) ? $desc[$status] : $status;
    }

    public static function trueAndFalse($status)
    {
        $desc = [
            CommonEnum::TRUE => '是',
            CommonEnum::FALSE => '否',
        ];
        if ($status === true) {
            return $desc;
        }
        return isset($desc[$status]) ? $desc[$status] : $status;
    }

    /**
     * 审核状态 0待审核 1审核失败 2审核成功
     * @param $status
     * @return mixed|string|string[]
     */
    public static function examineText($status)
    {
        $desc = [
            CommonEnum::check_stay => '待审核',
            CommonEnum::check_success => '成功',
            CommonEnum::check_fail => '失败',
        ];
        if ($status === true) {
            return $desc;
        }
        return isset($desc[$status]) ? $desc[$status] : $status;
    }

    /**
     * 商家（店铺）类型 1水站 2店铺
     * @param $level
     * @return mixed|string|string[]
     */
    public static function StoreTypeText($level)
    {
        $desc = [
            CommonEnum::shop => '联盟',
            CommonEnum::water => '水站',
        ];
        if ($level === true) {
            return $desc;
        }
        return isset($desc[$level]) ? $desc[$level] : $level;
    }

}